<#include "layout/template.ftl"/>

<@htmlHead title="账户列表">
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="${resources}/assets/css/jquery-ui.css" />
		<link rel="stylesheet" href="${resources}/assets/css/datepicker.css" />
		<link rel="stylesheet" href="${resources}/assets/css/ui.jqgrid.css" />
		<link rel="stylesheet" href="${resources}/plugins/jqgrid/4.6/jqgrid.extend.css" />
</@htmlHead>


 
<@htmlBody 'platform' 'account'>

	<!-- breadcrumbs begin -->
	<#include "layout/breadcrumbs.ftl">
	<@breadcrumbs '会员管理' '账户列表'></@breadcrumbs>
	<!-- breadcrumbs start -->

	<!-- page-content begin -->
	<div class="page-content">
			
			<!-- page-header begin -->
			<div class="page-header">
				<h1>
					<i class="fa fa-trophy"></i>&nbsp;账户列表  
					<a href="${path}/manage/platform/account/import" class="btn btn-sm btn-warning pull-right">
						<i class="ace-icon  fa fa-plus"></i> 导入
					</a>
					<a href="javascript:void(0)" onclick="exportExcelFile()" class="btn btn-sm btn-warning pull-right" style="margin-right: 20px;">
						<i class="ace-icon  fa fa-plus"></i> 导出
					</a>
				<h1>
				
				<div style="margin-top:20px;padding:10px 0px 0px 0px;border-top:1px solid #307ecc">
					<div style="float:right">
						<button id="find_btn"  class="btn btn-sm btn-primary">
							<i class="ace-icon fa fa-search"></i>查 询
						</button>
				    </div>
				    
				    <div id="query" class="query-view" style="">
						<ul class="list-inline">
							<li>	
					        	<label>身份证卡号:</label><input type="text" class="input" id="identitycard" name="identitycard" data-op="cn" /> 
							</li>
							<li>	
					        	<label>银行卡号:</label><input type="text" class="input" id="bankcard" name="bankcard" data-op="cn" /> 
							</li>
							<li>	
					        	<label>请选择银行:</label>
					        	<select id="corp" name="corp.id" data-op="eq"  class="input-sm">
					        		
					        	</select>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<!-- page-header end -->
	
			
			
			<!-- jqGrid begin -->
			<div class="row">	
				<div class="col-md-12">	
				  	<table id="grid-table"></table>
			 		<div id="grid-pager"></div>
				</div>
			</div>	
			<!-- jqGrid end -->
	</div>		
	<!-- page-content end -->	


</@htmlBody>



<@htmlBodyScript>

		<!-- 格式化货币 -->
		<script src="${resources}/plugins/tool/accounting.min.js"></script>
		<script src="${resources}/assets/js/date-time/bootstrap-datepicker.js"></script>
		<script src="${resources}/assets/js/jqGrid/jquery.jqGrid.src.js"></script>
		<script src="${resources}/assets/js/jqGrid/i18n/grid.locale-cn.js"></script>

		<script>
			

			var grid_selector = "#grid-table";
			var pager_selector = "#grid-pager";
		    var $path ='${path}';

			$(function(){
				ajaxCorp();
				//----------------------jqgrid查询开始 ---------------------
				//分页插件开始
				$("#grid-table").jqGrid({
					url: '${path}/manage/platform/account/list',
				 	mtype : "post", 
					datatype: "json",
					//prmNames : {search : "search"},  
					colNames:[ 'ID','身份证卡号','银行卡号','手机号','等级','积分','所属银行'],
				 	colModel: [
						{name:'id', width:60},
						{name:'identitycard'},
						{name:'bankcard'},
						{name:'telephone'},
						{name:'level'},
						{name:'score'},
						{name:'corp.name'}
						/****
						{
							name:'id', 
							width: 100,
							formatter :function(cellvalue, options, rawObject) {
					    	
					    	var option = '<div class="ui-op">'; 
					    		
					    		option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="编辑"  href="${path}/manage/bank/account/update/'+cellvalue+'">编辑';
				                option = option +'</a>'; 
			                   	if(rawObject.status!=2 ){ 
					                option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="停用"    href="${path}/manage/bank/account/disable/'+cellvalue+'"  onclick=\'return confirm("是否停用?");\'>停用';
				                	option = option +'</a>';  
			                	}
			                	if(rawObject.status!=1){ 
					                option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="启用"    href="${path}/manage/bank/account/enable/'+cellvalue+'"  onclick=\'return confirm("是否启用?");\'>启用'; 
				                	option = option +'</a>';  
			                	}
			                
					    		option = option +'<a class="" data-toggle="tooltip" data-placement="bottom" title="删除"  href="${path}/manage/bank/account/delete/'+cellvalue+'"  onclick=\'return confirm("是否删除?");\'>删除';
				                option = option +'</a>'; 
					    		
					    		
								option = option +'</div>';      
			               		return option;  
			               		
								
							}
						*/
					
						
					],
					viewrecords: true, 							// 在toolbar显示的当前页数,步长,总数
					autowidth: true,								//自动宽度
					height: "450",
					rowNum: 10,
					rowList:[10,50,100],
					sortname: 'id',
					sortorder: 'desc',
					pager: "#grid-pager",
					caption: "列表",
					loadComplete : function() {
						var table = this;
						setTimeout(function(){
							styleCheckbox(table);
							updateActionIcons(table);
							updatePagerIcons(table);
							enableTooltips(table);
						}, 0);
					}
					
				});
				//分页插件结束
				
				//------------------------------- 自定义查询开始 -------------------------------
				//自定义查询开始
				$("#find_btn").click(function(){ 
					searchData('${path}/manage/platform/account/list');
			    }); 
				//自定义查询结束
				
			})
			
			
			//异步查询企业信息
			function ajaxCorp(){
				
				$.ajax({
					type:"post",
					url:"${path}/manage/system/corp/getCorp",
					success:function(data){ 
							console.log(data);
							
							for(var i=0;i<data.result.length;i++){
								var html="";
								if(data.result[i].id!=1){
									html += "<option  value='"+data.result[i].id+"'>"+data.result[i].name+"</option>";
								}
								$("#corp").append(html);
							}
						}
				})
			}
			
			//导出Excel文件
			function exportExcelFile(){
				
				var corpId=$("#corp").val();
				
				window.location="${path}/manage/platform/account/export/"+corpId;
			}
			
			
			
		</script>	
	    <script src="${resources}/assets/js/jqGrid/jquery.jqGrid.Extract.js"></script>

</@htmlBodyScript>